package com.school.admin.common.utils;



import com.school.admin.common.config.WebSocketServer;
import com.school.admin.common.result.BaseResult;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author ：sunpx
 * @date ：Created in 2021/8/8 19:32
 * @description：获取系统参数工具类
 * @modified By：
 * @version: $
 */
@Component
public class BaseController {

    @Autowired
    public RedisUtil redisUtil;


    @Autowired
    public RedissonClient redissonClient;


    @Autowired
    WebSocketServer webSocketServer;

    /**
     * 获取参数
     *
     * @return
     */
    public Map<Object, Object> getSysParameterUtil() {
        Map<Object, Object> hmget = redisUtil.hmget(BaseResult.SysTypeMapping.SYS_PARAMETER.getType());
        return hmget;
    }

    /**
     * 获取封装api
     *
     * @return
     */
    public Map<String, String> getSelectApi() {
        Map<Object, Object> hashMapGet = redisUtil.hmget(BaseResult.SysTypeMapping.SELECT_TYPE_API.getType());
        Set<Object> objects = hashMapGet.keySet();

        Map<String, String> hashMap1 = new HashMap<>();

        objects.forEach(res -> {
            hashMap1.put((String) res, (String) hashMapGet.get(res));

        });

        return hashMap1;
    }




}
